package com.supermarket.seefood51.home.presenter

import android.content.Context
import com.supermarket.seefood51.entity.SeaFoodEntity
import com.supermarket.seefood51.entity.SeaFoodParentEntity
import com.supermarket.seefood51.home.model.HomeModel
import com.supermarket.seefood51.home.model.HomeModelImpl
import com.supermarket.seefood51.home.model.ProductModel
import com.supermarket.seefood51.home.view.HomeView
import com.supermarket.seefood51.home.view.ProductView
import com.supermarket.seefood51.linstener.OnLoadRequestListener


class ProductPresenter(var context: Context, var view : ProductView) : HomePresenter,OnLoadRequestListener<List<SeaFoodParentEntity>>{
    override fun onSuccess(t: List<SeaFoodParentEntity>?) {
        view.notifyDataChange(t!!)
    }


    private var homeModel  = ProductModel()




    override fun onFail(e: Throwable?) {

    }

    override fun requestList(worNumber: String) {
        homeModel.requestList(context,worNumber ,this)
    }


    override fun addCart(t: SeaFoodEntity) {
        homeModel.addCart(t)
    }
}